package cn.zl.ymcc.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageResult<T> {
    //条数
    private Long total = 0L;
    private long pageNum =1;
    private long pageSize=5;

    //列表
    private List<T> rows = new ArrayList<>();



    public static <T> PageResult<T> build(Long total, List<T> rows, long pageNum, long pageSize) {
        return PageResult.<T>builder()
                .total(total)
                .rows(rows)
                .pageNum(pageNum)
                .pageSize(pageSize)
                .build();
    }

}
